#ifndef SIMPLE_SORT_TYPES_H
#define SIMPLE_SORT_TYPES_H

#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

typedef int elem_t;

struct ss_array
{
	elem_t * p;

	size_t len;
};
typedef struct ss_array ss_array;

inline int
ss_array_clone(const ss_array * in, ss_array * out)
{
	out->len = in->len;
	out->p = malloc(sizeof(elem_t) * out->len);

	memcpy(out->p, in->p, in->len * sizeof(elem_t));

	return 0;
}

inline void
ss_array_release(ss_array * array)
{
	free(array->p);
}

struct ss_node
{
	elem_t data;

	struct ss_node * next;
};
typedef struct ss_node ss_node;
typedef ss_node * ss_list;

inline ss_node *
ss_node_create()
{
	ss_node * node = malloc(sizeof(ss_node));
	memset(node, 0, sizeof(node));
	return node;
}

inline void
ss_node_release(ss_node * node)
{
	free(node);
}

int ss_list_clone(const ss_list in, ss_list * out);

void ss_list_release(ss_list list);

#endif /* SIMPLE_SORT_TYPES_H */


